﻿@model DotaHelp.Models.Item



<table style="margin-top:5px;">
    <tr>
        <td style="vertical-align:top">
            <h2>@Html.LinkOnItem(Model) <br>
            @Model.Name <br>
            </h2>
            <h3>
            Другие названия: @Html.EditDialog("Items", "Nickname", Model.Id, Model.Nickname)<br>
            @if (Model.Nickname != null)
            {
                foreach (var nickName in Model.Nickname.Split(','))
                {
                    @nickName<br />
                }
            }

            </h3>

            <div><b>Цена:</b> @Model.Price   @Html.EditDialog("Items", "Price", Model.Id, Model.Price.ToString())</div>
        </td>
        <td style="vertical-align:top" rowspan="2">
            <h3 >Бонус: @Html.EditDialog("Items", "Bonus", Model.Id, Model.Bonus, null, true)</h3>
            @Html.Raw(Model.Bonus)
            @if (Model.Recipes1.Any())
            {
                <h3>Используется в:</h3>
                foreach (var r in Model.Recipes1)
                {
                    @Html.LinkOnItem(r.ForItem)
                }
            }

        </td>
    </tr>
    <tr>
        @if ((ViewData["Root"] as RecipeDrawItem).Childs.Any())
        {
            <td style="vertical-align:top">
                <h3>Рецепт:</h3>
                <div style="position:relative">        
                    <img src="@Url.Action("RecipeImage", new { itemId = Model.Id, lineColor = ((System.Drawing.Color)ViewData["Color"]).ToKnownColor(), v=2 })" />
                    @foreach (var drawItem in ((RecipeDrawItem)ViewData["Root"]).Foreach())
                    {
                        @Html.LinkOnItem(drawItem.Item, new {style = "position:absolute;left:" + drawItem.Position.X + "px;top:" + drawItem.Position.Y +"px"}
                            , isRecipe: drawItem.IsRecipe)
                    }
            </td>   
        }
    </tr>
</table>

